#ifndef _GAMEOBJECTS_H_
#define _GAMEOBJECTS_H_

#include "util_simplesprite.h"
#include "util_texshader.h"
#include "util_texture.h"

#define DEFAULT_Z_SCALE 1.0f
#define DEFAULT_Z_POS	0.0f

#define NUM_OF_PLAYERS 2
#define NUM_OF_WALLS 4

class CGameObjects
{
public:

	// Constructor
	CGameObjects()	:	_obj_shader(NULL), _obj_sprite(NULL)	{	setDefaults();	}

	//Destructor
	virtual ~CGameObjects(){};

	// Overide Methods
	virtual bool	initialise(LJMUUtilShaderTexPlain* pshader, ID3D10Device* pdevice,
								std::wstring ptexfilename, int pspritewidth, int pspriteheight);
	virtual bool	update(float ptpf);
	virtual bool	render(float ptpf, D3DXMATRIX pview, D3DXMATRIX portho);
	virtual bool	cleanup();

	// Accessors and Modifiers
	float	getXPos();
	float	getYPos();
	float	getRot();
	float	getXScale();
	float	getYScale();

	bool	isActive();

	LJMUUtilShaderTexPlain* getShader();
	LJMUUtilSimpleSprite*	getSprite();
	
	void	setXPos(float px);
	void	setYPos(float py);
	void	setRot(float pangle);
	void	setXScale(float px);
	void	setYScale(float py);
	void	setActive(bool pactive);

	// Public Methods
	float	getWidth();
	float	getHeight();
	float	getHalfWidth();
	float	getHalfHeight();
	
	void	setScale(float pscale);
	void	setPos(float px, float py);
	void	addScale(float pscale);
	void	addPos(float px, float py);
	void	addRot(float prot);

	// Method to randomly reset a game object's position on the sreen
	void	resetPos(float px, float py, float pangle);

	// Method for RECT
	void	setRect();

	// Using a reference "&" to pass the value type of RECT.
	RECT&	getRect();	

	// Methods for collision with screen
	void	scrollScreenRight(float px);
	void	scrollScreenLeft(float px);
	void	scrollScreenUp(float py);
	void	scrollScreenDown(float py);

	// Internal Methods
	void	setDefaults();

	// Member Variables
protected:

	float					_x_pos;
	float					_y_pos;
	float					_angle;
	float					_x_scale;
	float					_y_scale;

	bool					_active;

	// RECT for Game Objects
	RECT					_rect;

	// set rect dimensions sprite matrix (-getheight)

	// Matrices for Sprites
	D3DXMATRIX				_sprite_trans;
	D3DXMATRIX				_sprite_rot;
	D3DXMATRIX				_sprite_scale;
	D3DXMATRIX				_sprite_world;

/*
	// Matrices for RECTs
	D3DXMATRIX				_rect_trans;
	D3DXMATRIX				_rect_rot;
	D3DXMATRIX				_rect_scale;
	D3DXMATRIX				_rect_world;
*/

	LJMUUtilShaderTexPlain*	_obj_shader;
	LJMUUtilSimpleSprite*	_obj_sprite;
};

// Inline Methods
inline float CGameObjects::getXPos()
{
	return this->_x_pos;
}
/************************************/
inline float CGameObjects::getYPos()
{
	return this->_y_pos;
}
/************************************/
inline float CGameObjects::getRot()
{
	return this->_angle;
}
/************************************/
inline float CGameObjects::getXScale()
{
	return this->_x_scale;
}
/************************************/
inline float CGameObjects::getYScale()
{
	return this->_y_scale;
}
/************************************/
inline bool CGameObjects::isActive()
{
	return this->_active;
}
/************************************/
inline LJMUUtilShaderTexPlain* CGameObjects::getShader()
{
	return this->_obj_shader;
}
/************************************/
inline LJMUUtilSimpleSprite* CGameObjects::getSprite()
{
	return this->_obj_sprite;
}
/************************************/
inline void CGameObjects::setXPos(float px)
{
	this->_x_pos = px;
}
/************************************/
inline void CGameObjects::setYPos(float py)
{
	this->_y_pos = py;
}
/************************************/
inline void CGameObjects::setRot(float pangle)
{
	this->_angle = pangle;
}
/************************************/
inline void CGameObjects::setXScale(float px)
{
	this->_x_scale = px;
}
/************************************/
inline void CGameObjects::setYScale(float py)
{
	this->_y_scale = py;
}
/************************************/
inline void CGameObjects::setActive(bool pactive)
{
	this->_active = pactive;
}
/************************************/
inline void CGameObjects::scrollScreenRight(float px)
{
	this->_x_pos -= px;
}
/************************************/
inline void CGameObjects::scrollScreenLeft(float px)
{
	this->_x_pos += px;
}
/************************************/
inline void CGameObjects::scrollScreenUp(float py)
{
	this->_y_pos -= py;
}
/************************************/
inline void CGameObjects::scrollScreenDown(float py)
{
	this->_y_pos += py;
}
/************************************/
#endif